<!DOCTYPE html>
<html lang="en">

	<head>
		<title>Matrix Admin</title>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link rel="stylesheet" href="/css/bootstrap.min.css" />
	</head>

	<body>

		<div id="content">
			<div id="content-header">
			</div>
			<div class="container-fluid">
				<hr>
				<div class="row-fluid">
					<div class="widget-content nopadding">
			            <form class="form-horizontal" method="post" action="#" name="basic_validate" id="basic_validate" novalidate="novalidate">
			              <div class="control-group" style="display: none;">
			                <label class="control-label">服务名称</label>
			                <div class="controls">
			                  <input type="text" value="${configServerId}" name="config_server_id" id="config_server_id">
			                </div>
			              </div>
			              <div class="control-group">
			                <label class="control-label">服务名称</label>
			                <div class="controls">
			                  <input type="text" name="server_name" id="server_name">
			                </div>
			              </div>
			              <div class="control-group">
			                <label class="control-label">IP地址</label>
			                <div class="controls">
			                  <input type="text" name="server_ip" id="server_ip">
			                </div>
			              </div>
			              <div class="control-group">
			                <label class="control-label">用户名</label>
			                <div class="controls">
			                  <input type="text" name="server_user" id="server_user">
			                </div>
			              </div>
			              <div class="control-group">
			                <label class="control-label">密码</label>
			                <div class="controls">
			                  <input type="text" name="server_pwd" id="server_pwd">
			                </div>
			              </div>
			              <div class="control-group">
			                <label class="control-label">描述</label>
			                <div class="controls">
			                  <input type="text" name="server_desc" id="server_desc">
			                </div>
			              </div>
			              <div class="control-group">
			                <label class="control-label">根目录</label>
			                <div class="controls">
			                  <input type="text" name="config_dir" id="config_dir">
			                </div>
			              </div>
			            </form>
			          </div>
				</div>
			</div>
		</div>
		</div>
		<script src="/js/jquery.min.js"></script>
		<script src="/layer/layer.js"></script>
		<script type="text/javascript">
		
			function saveServerHandler(){
				
				// 进行表单验证
				var serverName = $("#server_name").val();
				var serverIp = $("#server_ip").val();
				var serverUser = $("#server_user").val();
				var serverPwd = $("#server_pwd").val();
				var configDir = $("#config_dir").val();
				
				if(serverName == '' || serverIp == '' || serverUser == '' || serverPwd == '' || configDir == ''){
					layer.alert('请正确输入服务器内容!');
				}
				else{
					$.ajax({
						type: "POST",
						url: "/server/add",
						data: $(basic_validate).serialize(),
						success: function(data) {
							parent.location.reload();
						}
					});
				}
			}
		</script>
	</body>

</html>